package edu.berkeley.cs160.bravo.project;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.TabHost;

public class Feesh extends TabActivity {
	/* Constants. */
	public static final String hostURL = "http://cs160bravo.iriscouch.com/";  // URL of CouchDB instance
	public static final String[] SUPPORTED_FISH = new String[] {  // List of supported fish
		"Betta", "Goldfish", "Guppy", "Shark"
	};
	
	public static String tank_cam_URL = "http://marklu.net:8070/?action=snapshot";  // URL of tank feed
	public static Long refresh_interval = (long) 1000;  // Interval at which to refresh tank feed, in milliseconds
	public static String device_URL = "http://inst.eecs.berkeley.edu/~marklu/feesh/action.php";  // URL of aquarium automation device
	public static Drawable tank_feed_cache;  // Cache of last frame retrieved
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
		Resources res = getResources();  // Resource object to get Drawables
		TabHost tabHost = getTabHost();  // The activity TabHost
		TabHost.TabSpec spec;  // Reusable TabSpec for each tab
		Intent intent;  // Reusable Intent for each tab
		
		/* Initialize a TabSpec for each tab and add it to the TabHost. */
		intent = new Intent().setClass(this, Home.class);  // Create an Intent to launch an Activity for the tab (to be reused)
		spec = tabHost.newTabSpec("Feesh").setIndicator("Feesh", res.getDrawable(android.R.drawable.ic_menu_manage)).setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this, Notifications.class);
		spec = tabHost.newTabSpec("Notifications").setIndicator("Notifications", res.getDrawable(android.R.drawable.ic_dialog_alert)).setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this, Feed.class);
		spec = tabHost.newTabSpec("Feed").setIndicator("Feed", res.getDrawable(android.R.drawable.ic_menu_add)).setContent(intent);
	    tabHost.addTab(spec);
	    
		intent = new Intent().setClass(this, Temperature.class);
		spec = tabHost.newTabSpec("Temperature").setIndicator("Temperature", res.getDrawable(android.R.drawable.ic_menu_report_image)).setContent(intent);
	    tabHost.addTab(spec);
	    
		intent = new Intent().setClass(this, pH.class);
		spec = tabHost.newTabSpec("pH").setIndicator("pH", res.getDrawable(android.R.drawable.ic_menu_report_image)).setContent(intent);
	    tabHost.addTab(spec);
	    
		intent = new Intent().setClass(this, Oxygen.class);
		spec = tabHost.newTabSpec("Oxygen").setIndicator("Oxygen", res.getDrawable(android.R.drawable.ic_menu_report_image)).setContent(intent);
	    tabHost.addTab(spec);
		
	    tabHost.setCurrentTab(0);
    }
}